<?php
namespace prog_index\lib {
    use pfp\lib as pfpLib;
    \defined( '_JEXEC' ) or die( 'Restricted access' );

    /**
     * Description of Config
     *
     * @todo 
     * 
     * @author George Zeakis<zeageorge@google.com>
     * 
     */
    class Config extends pfpLib\deepDynamicContainer{

        private $_prog_rootNamespace    = \NULL;
        private $_programEntryPointPath = \NULL;
        private $_prog_name             = \NULL;
        private $_config_file_path      = \NULL;
        
        public function __construct($progRootNamespace, $progEntryPointPath, $configuration_file_path, $progName){
            $this->_prog_rootNamespace    = $progRootNamespace;
            $this->_programEntryPointPath = $progEntryPointPath;
            $this->_prog_name             = $progName;
            parent::__construct(\NULL, "prog_".$this->_prog_name."_Config");
            
            if (!\is_readable($configuration_file_path)){ 
                //
                // todo: 
                //
                throw new \Exception("Program Configuration file is not readable"); 
            }

            try {
                require_once $configuration_file_path;
            } catch (\Exception $exc) {
                throw new \Exception("Could not read/parse program configuration file: ".$exc->getMessage());
            }

            $this->_config_file_path = $configuration_file_path;
        }

        public function __destruct() { parent::__destruct(); }
    }
}
?>
